<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

use Auth;

class Controller extends BaseController
{   
    protected $username;

    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public function __construct(){
        $this->MiddLeware('user.auth')->except('Fromlogin','captcha','login_input');//调用中间间验证->Kemel.php
        $this->Middleware(function ($request, $next) {
            if(Auth::guard('user')->user()){
                $this->username = Auth::guard('user')->user()->username;//获取当前用户名
            }
            //dd($request->session()->get('_token'));die;
            //dd(Auth::guard('user')->user());die;
            return $next($request);
        });
    }
}
